#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <mysql/mysql.h> 

MYSQL *conn;    /* pointer to connection handler */
MYSQL_RES *res;
MYSQL_ROW  row;

int main ( int argc, char *argv[] )
{
  int i;
  char *sql = (char *) malloc(sizeof(200));
  conn = mysql_init (NULL);
  mysql_real_connect (
                      conn,           /* pointer to connection handler */
                      "localhost",    /* host to connect to */
                      "root",    /* user name */
                      "123456",     /* password */
                      "test",         /* database to use */
                      0,              /* port (default 3306) */
                      NULL,           /* socket or /var/lib/mysql.sock */
                      0 );            /* flags (n one) */


  for(i = 0;i<100000;i++)
    {
      sprintf(sql,"insert into tenthousands (p1,p2,p3,p4) values(%d,%d,%d,%d);",i,i,i,i);      
      mysql_query(conn,sql);
    }
  return 0;
}
